package com.tecode.gmail.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created with Intellij IDEA.
 *
 * @Author: Gabriel
 * @Date: 2019-01-03
 * @Description:
 */
public class DateUtil {

	/**
	 * @Author Gabriel
	 * @Description //TODO
	 * @Date 2019/1/3
	 * @Param
	 * @Return
	 * 字符串转换为日期
	 *
	 */

	public static Date stringToDate(String date,String pattern) throws ParseException {
		SimpleDateFormat sf = new SimpleDateFormat(pattern);

		return  sf.parse(date);
	}
	/**
	 * @Author Gabriel
	 * @Description //TODO
	 * @Date 2019/1/3
	 * @Param
	 * @Return
	 * 日期转换字符串
	 */
	public static String dateToString(Date date,String pattern) {
		SimpleDateFormat sf = new SimpleDateFormat(pattern);

		return  sf.format(date);
	}


}